# -*- encoding: utf-8 -*-
# @Time       :  23:15
# @Author     : yuxian
# @Email      : 1503889663@qq.com
# @File       : myModelViewSet.py
# @SoftWare   : PyCharm
from django.views import View
from rest_framework.viewsets import ModelViewSet
from search_key.settings import DEBUG
from rest_framework.permissions import IsAuthenticated


class IsAuthenticatedViewSet(ModelViewSet):
    def __init__(self, **kwargs):
        if not DEBUG:
            self.permission_classes = IsAuthenticated
        super().__init__(**kwargs)

class IsAuthenticatedView(View):
    def __init__(self, **kwargs):
        if not DEBUG:
            self.permission_classes = IsAuthenticated
        super().__init__(**kwargs)
